package com.example.demo.service;

import com.example.demo.bean.PurchaseOrderDetail;
import com.example.demo.dao.PurchaseOrderDetailDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PurchaseOrderDetailService {
    @Autowired
    PurchaseOrderDetailDao dao;
    public int addPurchaseOrderDetail(PurchaseOrderDetail detail){
        return dao.addPurchaseOrderDetail(detail);
    }

    public int getCount(){
        return dao.getCount();
    }

    public int getCount(int order_id){
        return dao.getCount(order_id);
    }

    public int updatePurchaseOrderDetail(PurchaseOrderDetail detail){
        return dao.updatePurchaseOrderDetail(detail);
    }

    public int deletePurchaseOrderDetail(Integer detail_Id){
        return dao.deletePurchaseOrderDetail(detail_Id);
    }

    public List<PurchaseOrderDetail> getAllPurchaseOrderDetail(int page, int limit){
        return dao.getAllPurchaseOrderDetail(page, limit);
    }

    public List<PurchaseOrderDetail> findPurchaseOrderDetailByName(String name){
        return dao.findPurchaseOrderDetailByName(name);
    }

    public List<PurchaseOrderDetail> findAllPurchaseOrderDetailById(int page, int limit, int order_id){
        return dao.findAllPurchaseOrderDetailById(page, limit, order_id);
    }

    public int updateTotalAmount(int order_id){
        return dao.updateTotalAmount(order_id);
    }

    public List<PurchaseOrderDetail> getAllOrderProducts(int order_id){
        return dao.getAllOrderProducts(order_id);
    }

}
